<?php

class Controller {

	public function __construct($view=null) {
		if ($view !== null){
			$this->render($view);
		}
	}

	public function render($view){
		if (method_exists($this,"beforeRender")){
			$this->beforeRender();
		}

		// include view
		$cPath = strtolower(str_replace("Controller","",get_class($this)));
		require(APP_PATH.DS."views".DS.$cPath.DS.$view.".php");
		
		if (method_exists($this,"afterRender")){
			$this->afterRender();
		}
	}
	
}

?>